
#import "TestPost.h"
#import "TestUser.h"

#import "RequestManager.h"

@implementation TestPost
@synthesize m_id = _postID;
@synthesize m_text = _text;
@synthesize user = _user;



#pragma mark -

+ (void)globalTimelinePostsWithBlock:(void (^)(NSArray *posts, NSError *error))block {
    [[RequestManager sharedClient] getPath:@"stream/0/posts/stream/global" parameters:nil success:^(AFHTTPRequestOperation *operation, id JSON) {

//        NSLog(@"%@",JSON);
        NSMutableArray *mutablePosts = [TestPost arrayOfModelsFromDictionaries:[JSON valueForKeyPath:@"data"]];

        
        if (block) {
            block([NSArray arrayWithArray:mutablePosts], nil);
        }
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        if (block) {
            block([NSArray array], error);
        }
    }];
}

@end
